﻿<?php
	include '../inc/conn.php';
	
	session_start();	

	extract($_POST);
	extract($_GET);
	unset($_POST,$_GET);
	if (isset($act) && isset($id))
	{
		if ($act == "del"){
			$db = new mysql();
			$db->delete('eng_version_control_table', "id=".$id);
			$db->close();
			echo "<script>alert('Data has deleted!!!');window.location='admin_index.php?name=version';</script>";
		}
	}
?>
<div class="container-fluid">
<? if ($_SESSION['user'] != 1){  
	echo '<script>window.location="userinfo.php"</script>';
 } else {
?>
<div class="panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title">管理面板>>版本管控表</h3>
    </div>
    <div class="panel-body">
	<div>
		<table border=0 cellpadding=0 class="table table-striped">
		<tr class="success"><th>Item</th><th>机种</th><th>客户名称</th><th>BIOS版本</th><th>EC版本</th><th>管控人员</th><th>送测时间</th><th>品保链接</th><th>Admin</th></tr>
<?
		$db = new mysql();
		$db->query("select * from eng_version_control_table ORDER BY build_date DESC");
		$num = $db->db_num_rows();
		for($i=0; $i<$num; $i++){
			$row = $db->fetch_assoc();
			$item = $i + 1;
			echo "			<tr>";
			echo "<td>$item</td>";
			echo "<td><a href=\"../review_verlist.php?id=".$row['ID']."\">".htmlspecialchars_decode($row['Model_name'])."</a></td>";
			echo "<td>".htmlspecialchars_decode($row['Customer'])."</td>";
			echo "<td>".htmlspecialchars_decode($row['BIOS_version'])."</td>";
			echo "<td>".$row['EC_version']."</td>";
			echo "<td>".htmlspecialchars_decode($row['Owner'])."</td>";
			if ($row['Q_result']==0){
				echo "<td bgcolor='yellow'><font color='red'>".substr($row['Build_Date'],0,10)."</font></td>";
			}else{
				echo "<td>".substr($row['Build_Date'],0,10)."</td>";
			}
			echo "<td><a href='../qa_cfm.php?uid=".$row['UID']."'>链接</a></td>";
			echo "<td><a href='#' rel='tooltip' title='修改' onclick=\"javascript:window.open('mod_verlist.php?id=${row['ID']}', '修改', 'height=800, width=600, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no');\"><span class=\"glyphicon glyphicon-edit\"></span></a>";
			if (isset($_SESSION['admin']))
				echo "&nbsp;|&nbsp;<a href=\"admin_ver.php?id=".$row['ID']."&act=del\" rel='tooltip' title='删除表内容，当心哦~~~'><font color='red'><span class=\"glyphicon glyphicon-remove\"></span></font></a></td>";
			echo "</tr>\n";
		}
?>
		</table>
	</div>
</div>
</div>
</div>
<? 
}
	$db->close();
?>
